package com.mall.b2c.domain.delivery;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;

import com.mall.common.domain.BaseEntity;

/**
 * 快递单模版
 * 
 * @author lzx
 *
 */
@Entity
@Table(name="b2c_delivery_template")
public class DeliveryTemplateDomain extends BaseEntity {

	private static final long serialVersionUID = 4041162181404502923L;

	private String name; // 名称
	private String content; // 内容
	private Integer width; // 宽
	private Integer height; // 高
	private Integer offsetX; // 偏移x
	private Integer offsetY; // 偏移y
	private String background; // 模版背景图片
	private Boolean isDefault; // 是否默认
	private String memo; // 备注

	private DeliveryMethodDomain deliveryMethod; //配送方式
	
	@PrePersist
	public void prePersist(){
		if(isDefault == null){
			setIsDefault(false);
		}
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(max=2000)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Integer getWidth() {
		return width;
	}

	public void setWidth(Integer width) {
		this.width = width;
	}

	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}

	public Integer getOffsetX() {
		return offsetX;
	}

	public void setOffsetX(Integer offsetX) {
		this.offsetX = offsetX;
	}

	public Integer getOffsetY() {
		return offsetY;
	}

	public void setOffsetY(Integer offsetY) {
		this.offsetY = offsetY;
	}

	public String getBackground() {
		return background;
	}

	public void setBackground(String background) {
		this.background = background;
	}

	public Boolean getIsDefault() {
		return isDefault;
	}

	public void setIsDefault(Boolean isDefault) {
		this.isDefault = isDefault;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public DeliveryMethodDomain getDeliveryMethod() {
		return deliveryMethod;
	}

	public void setDeliveryMethod(DeliveryMethodDomain deliveryMethod) {
		this.deliveryMethod = deliveryMethod;
	}

}
